package P1085;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        byte[] dayTime = new byte[7];
        byte maxTime = 8;
        for (int i = 0; i < 7; ++i){
            for (int j = 0; j < 2; ++j){
                dayTime[i] += sc.nextInt();
            }
            if (dayTime[i] > maxTime) maxTime = dayTime[i];
        }
        if (maxTime <= 8){
            System.out.println('0');
            return;}
        for (int i = 0; i < 7; ++i){
            if (maxTime == dayTime[i]){
                System.out.println(i+1);
                return;}
        }
    }
}
